package com.bobamrz.domain;

// Generated 01.06.2013 15:30:51 by Hibernate Tools 4.0.0

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * Document generated by hbm2java
 */
@Entity
@Table(name = "document", schema = "public")
public class Document implements java.io.Serializable {

	private long document;
	private DocStatusType docStatusType;
	private String docNr;
	private String name;
	private String description;
	private Date created;
	private Long createdBy;
	private Date updated;
	private Long updatedBy;
	private String filename;
	private Set<DocumentDocCatalog> documentDocCatalogs = new HashSet<DocumentDocCatalog>(
			0);
	private Set<DocStatus> docStatuses = new HashSet<DocStatus>(0);
	private Set<DocAttribute> docAttributes = new HashSet<DocAttribute>(0);
	private Set<DocSubject> docSubjects = new HashSet<DocSubject>(0);
	private Set<DocumentDocType> documentDocTypes = new HashSet<DocumentDocType>(
			0);

	private DocumentDocType documentDocType;
	
	public Document() {
	}

	public Document(long document) {
		this.document = document;
	}

	public Document(long document, DocStatusType docStatusType, String docNr,
			String name, String description, Date created, Long createdBy,
			Date updated, Long updatedBy, String filename,
			Set<DocumentDocCatalog> documentDocCatalogs,
			Set<DocStatus> docStatuses, Set<DocAttribute> docAttributes,
			Set<DocSubject> docSubjects, Set<DocumentDocType> documentDocTypes,
			DocumentDocType documentDocType) {
		this.document = document;
		this.docStatusType = docStatusType;
		this.docNr = docNr;
		this.name = name;
		this.description = description;
		this.created = created;
		this.createdBy = createdBy;
		this.updated = updated;
		this.updatedBy = updatedBy;
		this.filename = filename;
		this.documentDocCatalogs = documentDocCatalogs;
		this.docStatuses = docStatuses;
		this.docAttributes = docAttributes;
		this.docSubjects = docSubjects;
		//this.documentDocTypes = documentDocTypes;
		this.documentDocType = documentDocType;
	}

	@Id
	@SequenceGenerator(name = "seqGenerator", sequenceName = "document_id")
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "seqGenerator")
	@Column(name = "document", unique = true, nullable = false, precision = 10, scale = 0)
	public long getDocument() {
		return this.document;
	}

	public void setDocument(long document) {
		this.document = document;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "doc_status_type_fk")
	public DocStatusType getDocStatusType() {
		return this.docStatusType;
	}

	public void setDocStatusType(DocStatusType docStatusType) {
		this.docStatusType = docStatusType;
	}

	@Column(name = "doc_nr")
	public String getDocNr() {
		return this.docNr;
	}

	public void setDocNr(String docNr) {
		this.docNr = docNr;
	}

	@Column(name = "name")
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "description")
	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "created", length = 29)
	public Date getCreated() {
		return this.created;
	}

	public void setCreated(Date created) {
		this.created = created;
	}

	@Column(name = "created_by", precision = 10, scale = 0)
	public Long getCreatedBy() {
		return this.createdBy;
	}

	public void setCreatedBy(Long createdBy) {
		this.createdBy = createdBy;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "updated", length = 29)
	public Date getUpdated() {
		return this.updated;
	}

	public void setUpdated(Date updated) {
		this.updated = updated;
	}

	@Column(name = "updated_by", precision = 10, scale = 0)
	public Long getUpdatedBy() {
		return this.updatedBy;
	}

	public void setUpdatedBy(Long updatedBy) {
		this.updatedBy = updatedBy;
	}

	@Column(name = "filename")
	public String getFilename() {
		return this.filename;
	}

	public void setFilename(String filename) {
		this.filename = filename;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "document", cascade = {CascadeType.ALL})
	public Set<DocumentDocCatalog> getDocumentDocCatalogs() {
		return this.documentDocCatalogs;
	}

	public void setDocumentDocCatalogs(
			Set<DocumentDocCatalog> documentDocCatalogs) {
		this.documentDocCatalogs = documentDocCatalogs;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "document")
	public Set<DocStatus> getDocStatuses() {
		return this.docStatuses;
	}

	public void setDocStatuses(Set<DocStatus> docStatuses) {
		this.docStatuses = docStatuses;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "document", cascade = {CascadeType.ALL})
	public Set<DocAttribute> getDocAttributes() {
		return this.docAttributes;
	}

	public void setDocAttributes(Set<DocAttribute> docAttributes) {
		this.docAttributes = docAttributes;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "document")
	public Set<DocSubject> getDocSubjects() {
		return this.docSubjects;
	}

	public void setDocSubjects(Set<DocSubject> docSubjects) {
		this.docSubjects = docSubjects;
	}
	//////////////////////////////
	@OneToMany(fetch = FetchType.LAZY, mappedBy = "document", cascade = {CascadeType.ALL})
	public Set<DocumentDocType> getDocumentDocTypes() {
		return this.documentDocTypes;
	}

	public void setDocumentDocTypes(Set<DocumentDocType> documentDocTypes) {
		this.documentDocTypes = documentDocTypes;
	}
	//////////////////////////////
	@OneToOne(fetch = FetchType.LAZY, mappedBy = "document", cascade = {CascadeType.ALL})
	public DocumentDocType getDocumentDocType() {
		return this.documentDocType;
	}

	public void setDocumentDocType(DocumentDocType documentDocType) {
		this.documentDocType = documentDocType;
	}

}
